package com.zggk.framework.controller.score;

import com.zggk.framework.service.score.GjAreaService;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.beans.factory.annotation.Autowired;
import com.platform.framework.controller.BaseController;
import org.springframework.web.bind.annotation.RequestMethod;
import javax.servlet.http.HttpServletRequest;
import org.springframework.web.servlet.ModelAndView;

/**
 * @Description 
 * @author 张立增[zhanglizeng] Tel：18860126570
 * @email 1472052711@qq.com
 * @date 2020-02-26 16:48:36
 */
@RestController
@RequestMapping("/gjArea")
public class GjAreaController extends BaseController{

    @Autowired
    GjAreaService gjAreaService;
    
    /**
	* @Description 跳转到主页面的方法
	* @author 张立增[zhanglizeng] Tel：18860126570
	* @createDate 2020-02-26 16:48:36
	*/
    @RequestMapping(value = "/index")
	public ModelAndView index() {
		ModelAndView mv = new ModelAndView("score/gjArea/index");
		return mv;
	}
    
   /**
	* @Description 跳转到添加页面的方法
	* @author 张立增[zhanglizeng] Tel：18860126570
	* @createDate 2020-02-26 16:48:36
	*/
    @RequestMapping(value = "/addPage")
	public ModelAndView addPage() {
		ModelAndView mv = new ModelAndView("score/gjArea/add");
		return mv;
	}
	
    /**
	 * @Description 保存添加的方法
	 * @author 张立增[zhanglizeng] Tel：18860126570
	 * @createDate 2020-02-26 16:48:36
	 */
	@RequestMapping(value="/add",method= {RequestMethod.POST})
	public String add(HttpServletRequest request) {
		String data = request.getParameter("data");
		return gjAreaService.add(data);
	}
	
	/**
	 * @Description 根据主键zq_code删除记录的方法
	 * @author 张立增[zhanglizeng] Tel：18860126570
	 * @createDate 2020-02-26 16:48:36
	 */
	@RequestMapping(value="/delete",method= {RequestMethod.POST})
	public String delete(HttpServletRequest request) {
		String zq_codes = request.getParameter("zq_codes");
		return gjAreaService.delete(zq_codes);
	}
	
    /**
	 * @Description 跳转到编辑页面的方法
	 * @author 张立增[zhanglizeng] Tel：18860126570
	 * @createDate 2020-02-26 16:48:36
	 */
	@RequestMapping(value = "/editPage")
	public ModelAndView editPage() {
		ModelAndView mv = new ModelAndView("score/gjArea/edit");
		return mv;
	}
	
	/**
	 * @Description 保存编辑记录的方法
	 * @author 张立增[zhanglizeng] Tel：18860126570
	 * @createDate 2020-02-26 16:48:36
	 */
	@RequestMapping(value="/edit",method= {RequestMethod.POST})
	public String edit(HttpServletRequest request) {
		String data = request.getParameter("data");
		return gjAreaService.edit(data);
	}
    
    /**
	 * @Description 查询列表
	 * @author 张立增[zhanglizeng] Tel：18860126570
	 * @createDate 2020-02-26 16:48:36
	 */
	@RequestMapping(value = "/list",method= {RequestMethod.POST})  
	public Object list(HttpServletRequest request) throws Exception {
	    String searchData = request.getParameter("searchData");    
	    String page = request.getParameter("page");    
	    String limit = request.getParameter("limit");    
		return gjAreaService.list(searchData,page,limit);
	}
	
	/**
	 * @Description 得到全部的政区集合
	 * @author 张立增
	 * @Date 2020年2月26日 下午4:54:36
	 */
	@RequestMapping(value = "getAllList", method = { RequestMethod.POST, RequestMethod.GET })
	public String getAllList(HttpServletRequest request) throws Exception {
		return gjAreaService.getAllList();
	}
	

   
}
